import React, { useEffect, useState } from 'react';

const App = () => {
  const [count, setCount] = useState(0);

  // 渲染本身引起的操作,常见就是发送网络请求
  useEffect(() => {
    // 渲染初始化了
    console.log('count 发生变化:', count);
    return ()=>{
      console.log('组件销毁了')
    }
  }, [count])



  return (
    <div>
      <button onClick={() => setCount(count + 1)}>增加</button>
    </div>
  )
};

export default App;
